<template>
  <el-dialog class="custom-dialog" :width="dialogWidth" :show-close="false" :close-on-click-modal="false" :close-on-press-escape="false" :lock-scroll="false" :visible.sync="dialogVisible">
    <!-- <el-dialog class="custom-dialog" width="30%" :title="dialogTitle" :visible.sync="visible" @close="close"> -->
    <div slot="title" class="dialog-header">
      <div class="header-left">
        <h4 class="dialog-title">{{ dialogTitle }}</h4>
        <slot name="custom" />
      </div>
      <span class="close-icon" @click="close" />
    </div>
    <slot />
    <div slot="footer">
      <slot name="footer" />
    </div>
  </el-dialog>
</template>
<script>
export default {
  props: {
    dialogTitle: {
      type: String,
      default: function() {
        return this.$t('dialog.tip')
      }
    },
    dialogVisible: {
      type: Boolean,
      default: false
    },
    dialogWidth: {
      type: String,
      default: '30%'
    }
  },
  // data () {
  //   return {
  //     visible: this.dialogVisible
  //   }
  // },
  methods: {
    close: function(e) {
      // e.preventDefault();
      this.$emit('dialog-close')
    }
  }
}
</script>

<style scoped>
.custom-dialog >>> .el-dialog {
  border-radius: 4px;
  min-width: 300px;
}
.custom-dialog >>> .el-dialog__header {
  border-bottom: 1px solid #efefef;
  background: #f1f7ff;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  padding: 10px 20px 10px 25px;
}
.custom-dialog .dialog-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
/* .custom-dialog>>> .el-dialog__title{
    font-size: 16px;
    color: #7a7a7a;
  } */
.custom-dialog .dialog-title {
  /* font-size: 16px; */
  font-size: 18px;
  /* color: #7a7a7a; */
  color: #58585b;
  margin: 0;
  font-weight: normal;
}
.custom-dialog >>> .el-dialog__close {
  border: 1px solid #3869fb;
  border-radius: 50%;
  /* font-size: 16px; */
  font-size: 18px;
  color: #3869fb;
}
.custom-dialog .close-icon {
  width: 40px;
  height: 40px;
  background: url(/static/images/close.png);
  display: inline-block;
  cursor: pointer;
}
.custom-dialog >>> .el-dialog__body {
  padding: 30px 15% 15px;
}
.custom-dialog >>> .el-dialog__body .msg {
  word-break: break-all;
}
.custom-dialog >>> .el-dialog__footer {
  padding: 0px 15% 30px;
}
/* .custom-dialog>>> .dialog-footer{
    display: flex;
    justify-content: space-between;
  } */
/* .custom-dialog>>> .one-btn{
    justify-content: flex-end;
  } */
.custom-dialog >>> .dialog-footer:after {
  display: block;
  content: "";
  clear: both;
}
.custom-dialog >>> .el-button--default {
  color: #fff;
  /* font-size: 16px; */
  font-size: 14px;
  background: #ccc;
  border-color: #ccc;
  float: left;
  padding: 0;
  width: 86px;
  height: 38px;
}
.custom-dialog >>> .el-button--primary {
  /* font-size: 16px; */
  font-size: 14px;
  background: #4c70f7;
  border-color: #4c70f7;
  float: right;
  padding: 0;
  width: 86px;
  height: 38px;
}
.custom-dialog >>> .el-button--primary:hover {
  background: #4c70f7;
}
.custom-dialog >>> .wait-commit {
  float: right;
}
.custom-dialog >>> .el-form-item__label {
  /* font-size: 16px;
    color: #7a7a7a; */
  font-size: 14px;
  color: #58585b;
  /*line-height: 1;*/
}
.custom-dialog >>> .el-form-item__label:after {
  content: "";
  display: inline-block;
  width: 0;
  height: 100%;
  vertical-align: middle;
}
.custom-dialog >>> .msg {
  /* font-size: 16px;
    color: #7a7a7a; */
  font-size: 14px;
  color: #58585b;
  padding-bottom: 30px;
  display: block;
}
.custom-dialog >>> .el-input__inner {
  background: transparent;
}
@media screen and (max-width: 1344px) {
  .custom-dialog >>> .el-dialog {
    width: 40% !important;
  }
}
@media screen and (max-width: 1066px) {
  .custom-dialog >>> .el-dialog {
    width: 50% !important;
  }
}
@media screen and (max-width: 796px) {
  .custom-dialog >>> .el-dialog {
    width: 70% !important;
  }
}
@media screen and (max-width: 496px) {
  .custom-dialog >>> .el-dialog {
    width: 90% !important;
  }
  .custom-dialog >>> .el-dialog__body {
    padding: 30px 5% 15px;
  }
  .custom-dialog >>> .el-dialog__footer {
    padding: 0px 5% 30px;
  }
}
</style>

// WEBPACK FOOTER //
// src/components/common/dialog.vue
